import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//import elementUi from 'element-ui'
import './plugins/element'
import './assets/css/fonts/iconfont.css'

//导入全局样式表
import './assets/css/global.css'

import axios from "axios";
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'

//设置请求拦截，因为除了login接口之外所有请求都需要token，所以在请求到达服务器之前先设置请求拦截，为每个Header加上token
//axios.interceptors.request.use()
axios.interceptors.request.use(config=>{
  console.log(config);
  config.headers.Authorization = window.sessionStorage.getItem('token')

  return config //固定写法，必须return config
})

Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
